<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>title</title>
    <link rel="stylesheet" href="../assets/agile/css/ratchet/css/ratchet.min.css">
    <link rel="stylesheet" href="../assets/agile/css/flat/flat.component.css">
    <link rel="stylesheet" href="../assets/agile/css/flat/iconline.css">
    <link rel="stylesheet" href="../assets/app/css/app.css" />
    <script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script type="text/javascript" src="../script/local.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
</head>
<body>
<!--通用顶部-->
<div id="ios-top-box">
	<div id="header" class="bar bar-nav">
	<div class="titlebar">
	<a href="javascript:appClose('cate_goods',api);"><i class="iconfont iconline-arrow-left"></i></a>
	<h1 class="title">加载中...</h1>
	</div>
	</div>
</div>
<!--通用顶部结束-->
<section style="margin-top:44px;">
<div class="scroller create_goods container" style="max-width: 640px;">

</div>
</section>

<script type="text/javascript">
apiready = function(){
	tag = localData.get('cateid');
	if(!tag){
		api.alert({title:'提示',msg:'商品分类不存在'},function(index,err){
			appClose('cate_goods',api);
		});
		return;
	}
api.showProgress({'title':'加载中...','text':''});
ajaxData(40,1,'',tag,api);
function ajaxData(order_type,page,flag,tag,api){
    //order_type = 10;
    $('.btn-more').text('加载中...');
    GetJPData(config.url+'/app.php?act=appgoodsList&show='+tag+'&sort='+order_type+'&page='+page,{},function(json){

    	api.hideProgress();
    	$('.title').text(json[0]['catename']);
        var txt = '';
        var html = '';
        for(var i=0; i < json.length; i++){
            if(json[i]['title'] == undefined){
                break;
            }
            html += '<ul class="search-ul"><li>';
            html += '<div class="search_goods_img"><a href="javascript:openItem(\'item\','+json[i]['id']+',function(id){localData.set(\'goods_id\',id);});"><img class="lazy" data-original="'+config.upload_url +'/'+ json[i]['thumb'] +'" /></a></div>';
            html += '<div class="search_goods_info">';
            html += '<p class="title_shopname"><a href="javascript:openItem(\'item\','+json[i]['id']+',function(id){localData.set(\'goods_id\',id);});">'+ json[i]['title'] +'</a></p>';
            html += '<div class="goods_info_bottom"><div class="goods_con"><progress max="100" value="'+parseInt((json[i]['canyurenshu']/json[i]['zongrenshu'])*100)+'" class="css3">';
            html += '<div class="progress-bar"></div></progress>';
            html += '<p><span class="left">总需：'+json[i]['zongrenshu']+'</span><span class="right">剩余：'+json[i]['shenyurenshu']+'</span></p>';
            html += '</div><div class="btn_buy addCart" item="'+json[i]['id']+'" onclick="addCart('+json[i]['id']+','+json[i]['yunjiage']+',1);">购买</div>';
            html += '</div></div></li></ul>';
        }
        $('.container').append(html);
        setTimeout(function(){
            lyzimg();
            if(flag == false){
                if(txt == ''){
                $('.btn-more').text('已经到底了');
                }else{
                    $('.btn-more').text(txt);
                    $('.container').width($(window).width());
                }
            }else{
                $('.container').width('auto');
                $('.btn-more').text('加载更多');
                }
            $('.load-more').show();
        },1000);
    });
    
}
}
</script>
</body>
</html>